//
//  SuccessHeadView.m
//  TodatPlay
//
//  Created by dllo on 16/9/19.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "SuccessHeadView.h"
#import "SDAutoLayout.h"
#import "UIView+Frame.h"
#import "TAMacro.h"
@implementation SuccessHeadView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithRed:0.386 green:0.046 blue:0.094 alpha:1.000];
        [self createContents];
    }
    return self;
}

- (void)createContents {
    self.picImageView = [UIImageView new];
    self.userLabel = [UILabel new];
    self.ageAndSexlabel = [UILabel new];
    self.attentionLabel = [UILabel new];
    self.numOfattention = [UILabel new];
    self.fansLabel = [UILabel new];
    self.numOfFans = [UILabel new];
    self.funnyLabel = [UILabel new];
    self.numOfFunny = [UILabel new];
    UIView *backView = [UIView new];
    [self addSubview:_picImageView];
    [self addSubview:_userLabel];
    [self addSubview:_ageAndSexlabel];
    [self addSubview:backView];
    [backView addSubview:_attentionLabel];
    [backView addSubview:_numOfattention];
    [backView addSubview:_fansLabel];
    [backView addSubview:_numOfFans];
    [backView addSubview:_funnyLabel];
    [backView addSubview:_numOfFunny];
    
    self.picImageView.sd_layout
    .centerXEqualToView(self)
    .centerYEqualToView(self).offset(-44)
    .widthIs(SCREEN_WIDTH / 8.0)
    .heightIs(SCREEN_WIDTH / 8.0);
    self.picImageView.layer.cornerRadius = SCREEN_WIDTH / 16.0;
    self.picImageView.layer.masksToBounds = YES;
    
    _picImageView.backgroundColor = [UIColor yellowColor];
    self.userLabel.sd_layout
    .centerXEqualToView(_picImageView)
    .topSpaceToView(_picImageView, 5)
    .widthRatioToView(self, 0.5)
    .heightIs(20);
    
    self.ageAndSexlabel.sd_layout
    .centerXEqualToView(_picImageView)
    .topSpaceToView(_userLabel, 5)
    .widthRatioToView(self, 0.5)
    .heightIs(20);
    
    backView.sd_layout
    .leftEqualToView(self)
    .rightEqualToView(self)
    .bottomEqualToView(self)
    .heightIs(44);
    
    _numOfattention.sd_layout
    .leftEqualToView(self)
    .topSpaceToView(backView, 2)
    .heightIs(20)
    .widthRatioToView(self, 1 / 3.0);
    
    _numOfFans.sd_layout
    .centerXEqualToView(backView)
    .widthRatioToView(self, 1 / 3.0)
    .heightIs(20)
    .topSpaceToView(backView, 2);
    
    _numOfFunny.sd_layout
    .rightEqualToView(self)
    .topSpaceToView(backView, 2)
    .widthRatioToView(self, 1 / 3.0)
    .heightIs(20);
    
    _attentionLabel.sd_layout
    .centerXEqualToView(_numOfattention)
    .widthRatioToView(self, 1 / 3.0)
    .heightIs(20)
    .topSpaceToView(_numOfattention, 2);
    
    _fansLabel.sd_layout
    .centerXEqualToView(_numOfFans)
    .widthRatioToView(self, 1 / 3.0)
    .heightIs(20)
    .topSpaceToView(_numOfFans, 2);
    
    _funnyLabel.sd_layout
    .centerXEqualToView(_numOfFunny)
    .widthRatioToView(self, 1 / 3.0)
    .heightIs(20)
    .topSpaceToView(_numOfFunny, 2);
    
    _userLabel.font = [UIFont systemFontOfSize:13];
    _userLabel.textAlignment = NSTextAlignmentCenter;
    _userLabel.textColor = [UIColor whiteColor];
    
    _ageAndSexlabel.font = [UIFont systemFontOfSize:13];
    _ageAndSexlabel.textAlignment = NSTextAlignmentCenter;
    _ageAndSexlabel.textColor = [UIColor whiteColor];
    
    _attentionLabel.font = [UIFont systemFontOfSize:13];
    _attentionLabel.textAlignment = NSTextAlignmentCenter;
    _attentionLabel.textColor = [UIColor whiteColor];
    
    _numOfattention.font = [UIFont systemFontOfSize:13];
    _numOfattention.textAlignment = NSTextAlignmentCenter;
    _numOfattention.textColor = [UIColor whiteColor];
    
    _fansLabel.font = [UIFont systemFontOfSize:13];
    _fansLabel.textAlignment = NSTextAlignmentCenter;
    _fansLabel.textColor = [UIColor whiteColor];
    
    _numOfFans.font = [UIFont systemFontOfSize:13];
    _numOfFans.textAlignment = NSTextAlignmentCenter;
    _numOfFans.textColor = [UIColor whiteColor];
    
    _funnyLabel.font = [UIFont systemFontOfSize:13];
    _funnyLabel.textAlignment = NSTextAlignmentCenter;
    _funnyLabel.textColor = [UIColor whiteColor];
    
    _numOfFunny.font = [UIFont systemFontOfSize:13];
    _numOfFunny.textAlignment = NSTextAlignmentCenter;
    _numOfFunny.textColor = [UIColor whiteColor];
    
    backView.backgroundColor = [UIColor colorWithRed:0.055 green:0.027 blue:0.073 alpha:0.167];
    
    
}













@end
